﻿using Face8280WebSocketServer.WebSockt;
using Face8280WebSocketServer.Command;
using Face8280WebSocketServer.Command.IPPar;
using DoNetDrive.AspWebSocke.WebSocketClient;
using DoNetDrive.Core.Command;
using DoNetDrive.Core.Command.Text;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Serialization;

namespace Face8280WebSocketServer.Controllers.Test
{
    [Route("api/[controller]")]
    [ApiController]
    public class WebSocketTestController : ControllerBase
    {
        private readonly ILogger<WebSocketTestController> _logger;
        public WebSocketTestController(ILogger<WebSocketTestController> logger)
        {
            _logger = logger;
        }
        [HttpGet("GetIpAddr")]
        public string GetIpAddr(string sn)
        {
            //var cmdDetail = GetCommandDetail();
            //GetIPPar cmd = new GetIPPar(cmdDetail);
            //await Allocator.AddCommandAsync(cmd);
            //var result = cmd.getResult();
            return "Test";
        }

        private INCommandDetail GetCommandDetail()
        {
            WebSocketClientDetail connDtl = new WebSocketClientDetail("FC-A102E19090013", "ws://192.168.1.130:8600/ws");

            var cmdDtl = new TextCommandDetail(connDtl)
            {
                Timeout = 3000
            };
            return cmdDtl;
        }
    }
}
